package com.hdjk.view.callback;

import com.lst.projectlib.entity.Msg;

import org.json.JSONArray;
import org.json.JSONObject;

import okhttp3.Response;

/**
 * Created by Admin on 2017/10/25.
 */

public abstract class RechargeWalletCallback extends MsgCallBack {
    @Override
    public Msg parseNetworkResponse(Response response, int id)
            throws Exception {
        Msg msg = super.parseNetworkResponse(response, id);
        JSONArray array = (JSONArray) msg.getData();
        if (array != null) {
            String status = "";
            for (int j = 0; j < array.length(); j++) {
                JSONObject jsonObject = array.getJSONObject(j);
                if (!jsonObject.isNull("transactionStatus")) {
                    status = jsonObject.getString("transactionStatus");
                }
            }
            msg.setData(status);
        }
        return msg;
    }
}